<template>
  <div class="register">
    <h1 class="header">注册</h1>
 <van-form @submit="onSubmit">
  <van-field
    v-model="user"
    name="用户名"
    placeholder="用户名"
    :rules="[{ required: true, message: '请填写用户名' }]"
  />
  <van-field
    v-model="password"
    type="password"
    name="密码"
    placeholder="密码"
    :rules="[{ required: true, message: '请填写密码' }]"
  />
  <div style="margin: 16px;">
    <van-button round block type="info" native-type="submit" style=" background:#FD4A25; color:white; border: 1px solid #FD4A25; ">
      提交
    </van-button>
  </div>
</van-form>  

  </div>
</template>
<script>

import {userregister} from '@/api/user.ts';
import Vue from 'vue';
import { Form,Button,Field } from 'vant';
Vue.use(Field);
Vue.use(Form);
Vue.use(Button);

export default {
  data() {
    return {
      user: '',
      password: '',
    };
  },
  methods: {
    onSubmit(values) {
      console.log('submit', values);
      userregister(this.user,this.password)
    },
  },

};


</script>
<style lang="scss">
  .register{
    width: 100%;
    height: 100%;
    font-size: 13px;
    .header{
      width: 100%;
      height: .9rem;
      font-size: 16px;
      text-align: center;
      line-height: .9rem;
    }
  }
 
</style>


